/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.entity;

import com.qinyeit.serviceapp.entity.enums.MemberCardState;
import com.qinyeit.serviceapp.entity.enums.MemberMakeCardType;
import com.qinyetech.springstage.core.entity.AbstractEntity;

import javax.persistence.*;
import javax.validation.constraints.NotEmpty;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Builder;
import lombok.experimental.Tolerate;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * ClassName: MemberCard <br/>
 * Function: 会员卡 <br/>
 * date: 2018-12-04 11:15:51 <br/>
 *
 * @author liuwenjin
 * @version  1.0
 * @since JDK 1.8
 */
@Builder
@Entity
@Table(name="member_cards")
public class MemberCard extends MerchantGroupBaseEntity<Long> {

	private static final long serialVersionUID = 1L;

	// 门店id 
    @Column(name="branch_id")
	private Long branchId = null;

	// 卡的uuid 
    @Column(name="uuid", length = 300)
	private String uuid = null;

	// 批次id 
    @Column(name="batch_id")
	private Long batchId = null;

	// 卡号 
    @Column(name="no", length = 300)
	private String no = null;

	// 会员 
    @Column(name="vip_id")
	private Long vipId = null;

	// 卡类型
	@JoinColumn(name="type_id")
	@ManyToOne
	private MemberCardType type = null;

	// 密码 
    @Column(name="password", length = 300)
	private String password = null;

	// 卡押金 
    @Column(name="deposit",scale=2)
	private Double deposit = 0d;

	// 赠送积分 
    @Column(name="gift_point",scale=2)
	private Double giftPoint = 0d;

	// 账户余额 
    @Column(name="amount",scale=2)
	private Double amount = 0d;

	// 赠送金额 
    @Column(name="gift_amount",scale=2)
	private Double giftAmount = 0d;

	// 积分 
    @Column(name="point",scale=2)
	private Double point = 0d;

	// 有效期开始 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="start_time")
	private Date startTime = null;

	// 有效期结束 
	@JSONField(format="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm")
    @Column(name="end_time")
	private Date endTime = null;

	// 状态 
    @Column(name="state", length = 300)
	@Enumerated(EnumType.STRING)
	private MemberCardState state = MemberCardState.NORMAL;

	// 累计赠送金额
	@Column(name="total_gift_amount",scale=2)
	private Double totalGiftAmount = 0d;

	//累计积分
	@Column(name = "total_point")
	private Double totalPoint = 0d;

	// 账户累计金额
	@Column(name="total_amount",scale=2)
	private Double totalAmount = 0d;


	// 会员卡片类型
	@Column(name="make_card_type")
	@Enumerated(EnumType.STRING)
	private MemberMakeCardType makeCardType = MemberMakeCardType.VIRTUALCARD;



	@Tolerate
	public MemberCard() {
		
	}
    @Tolerate
	public MemberCard(Long id){
    	super.setId(id);
    }
	
	/**
	 * 获取门店id
	 */
	public Long getBranchId() {
		return this.branchId;
	}

    /**
     * 设置门店id
     */
	public MemberCard setBranchId(Long branchId) {
		this.branchId = branchId;
		return this;
	}

	/**
	 * 获取卡的uuid
	 */
	public String getUuid() {
		return this.uuid;
	}

    /**
     * 设置卡的uuid
     */
	public MemberCard setUuid(String uuid) {
		this.uuid = uuid;
		return this;
	}

	/**
	 * 获取批次id
	 */
	public Long getBatchId() {
		return this.batchId;
	}

    /**
     * 设置批次id
     */
	public MemberCard setBatchId(Long batchId) {
		this.batchId = batchId;
		return this;
	}

	/**
	 * 获取卡号
	 */
	public String getNo() {
		return this.no;
	}

    /**
     * 设置卡号
     */
	public MemberCard setNo(String no) {
		this.no = no;
		return this;
	}

	/**
	 * 获取会员
	 */
	public Long getVipId() {
		return this.vipId;
	}

    /**
     * 设置会员
     */
	public MemberCard setVipId(Long vipId) {
		this.vipId = vipId;
		return this;
	}


	/**
	 * 获取密码
	 */
	public String getPassword() {
		return this.password;
	}

    /**
     * 设置密码
     */
	public MemberCard setPassword(String password) {
		this.password = password;
		return this;
	}

	/**
	 * 获取卡押金
	 */
	public Double getDeposit() {
		return this.deposit;
	}

    /**
     * 设置卡押金
     */
	public MemberCard setDeposit(Double deposit) {
		this.deposit = deposit;
		return this;
	}

	/**
	 * 获取赠送积分
	 */
	public Double getGiftPoint() {
		return this.giftPoint;
	}

    /**
     * 设置赠送积分
     */
	public MemberCard setGiftPoint(Double giftPoint) {
		this.giftPoint = giftPoint;
		return this;
	}

	/**
	 * 获取账户余额
	 */
	public Double getAmount() {
		return this.amount;
	}

    /**
     * 设置账户余额
     */
	public MemberCard setAmount(Double amount) {
		this.amount = amount;
		return this;
	}

	/**
	 * 获取赠送金额
	 */
	public Double getGiftAmount() {
		return this.giftAmount;
	}

    /**
     * 设置赠送金额
     */
	public MemberCard setGiftAmount(Double giftAmount) {
		this.giftAmount = giftAmount;
		return this;
	}

	/**
	 * 获取积分
	 */
	public Double getPoint() {
		return this.point;
	}

    /**
     * 设置积分
     */
	public MemberCard setPoint(Double point) {
		this.point = point;
		return this;
	}

	/**
	 * 获取有效期开始
	 */
	public Date getStartTime() {
		return this.startTime;
	}

    /**
     * 设置有效期开始
     */
	public MemberCard setStartTime(Date startTime) {
		this.startTime = startTime;
		return this;
	}

	/**
	 * 获取有效期结束
	 */
	public Date getEndTime() {
		return this.endTime;
	}

    /**
     * 设置有效期结束
     */
	public MemberCard setEndTime(Date endTime) {
		this.endTime = endTime;
		return this;
	}

	public MemberCardType getType() {
		return type;
	}

	public void setType(MemberCardType type) {
		this.type = type;
	}

	public MemberCardState getState() {
		return state;
	}

	public void setState(MemberCardState state) {
		this.state = state;
	}

	public Double getTotalGiftAmount() {
		return totalGiftAmount;
	}

	public void setTotalGiftAmount(Double totalGiftAmount) {
		this.totalGiftAmount = totalGiftAmount;
	}

	public Double getTotalPoint() {
		return totalPoint;
	}

	public void setTotalPoint(Double totalPoint) {
		this.totalPoint = totalPoint;
	}

	public Double getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(Double totalAmount) {
		this.totalAmount = totalAmount;
	}

	public MemberMakeCardType getMakeCardType() {
		return makeCardType;
	}

	public void setMakeCardType(MemberMakeCardType makeCardType) {
		this.makeCardType = makeCardType;
	}
}
